Skip to content

Conversation

@valadaptive
Copy link
Contributor

This was discussed a bit in #122. We were previously omitting architecture-specific tests based on the host architecture, which is incorrect and prevents cross-compiling tests to run under something like qemu.

We can't access CARGO_CFG_TARGET_ARCH at the time that proc macros are evaluated, so we just have to build every architecture-specific test and use #[cfg] to disable ones that aren't applicable to the current architecture.

Even more annoyingly, there's no way to conditionally ignore a test at runtime. This means that if the CPU we're running the tests on doesn't support a target feature, we have to either pass or fail that test. I've chosen to fail, to prevent faulty code from appearing to pass tests.

I've also updated the architecture-specific exclude functions to add #[ignore] attributes rather than omitting the tests entirely. This makes it more clear that the tests exist, but are not being run because they don't yet pass.

@valadaptive
Copy link
Contributor Author

Hmm, it seems this has caught something already. The macOS x86 CI machines don't support AVX2. Should I:

  • Change the tests to pass if the required target features aren't available?
  • Run them in Rosetta 2 on a macOS aarch64 runner?
  • Just hold off on this for now?

@DJMcNab
Copy link
Member

DJMcNab commented Nov 15, 2025

I think the only reasonable options within the bounds that libtest gives us is to pass the test.

I think we should have one test, which is ignored on CI (i.e. with an environment variable), which requires that you have all the supported levels on your machine.
That ensures that contributors with underpowered machines know that some of the test successes might be phantom.

Ideally, we'd point to Qemu to fix this, although I'm not sure how realistic that is.

@valadaptive
Copy link
Contributor Author

I've updated the tests to operate as per your suggestion: they pass if the SIMD level they're testing is not supported, and there's now one additional test (skipped on CI) that fails if all SIMD levels are not supported.

Copy link
Member

@DJMcNab DJMcNab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, we'd validate automatically that CI does run all of these tests, but that's begging for flaky CI.

I wonder if it's worth setting up QEMU emulation for this anyway; but that should be a follow-up.

Copy link
Member

@DJMcNab DJMcNab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@valadaptive valadaptive added this pull request to the merge queue Nov 19, 2025
Merged via the queue into linebender:main with commit ec916db Nov 19, 2025
18 checks passed
@valadaptive valadaptive deleted the cross-test branch November 19, 2025 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants